package com.fqgj.xjd.user.test.write;/**
 * Created by Tim on 2017/7/25.
 */

import com.fqgj.framework.test.utils.WriteUtils;
import com.fqgj.xjd.user.client.request.UserAppInfo;
import com.fqgj.xjd.user.client.request.UserAccess;
import com.fqgj.xjd.user.client.enums.PlatformEnum;
import org.junit.Test;

/**
 * create by 陈樟杰
 * 这个类帮助生成需要的json文件
 */
public class WriteJson {

    private String filepath = "E:\\IdeaProjects\\xjd-user\\user-server\\src\\test\\resources\\json\\";

    /**
     * 运行方法时可以直接当test方法运行
     * 闪电周转注册接口json
     */
    @Test
    public void registerSDZZ() throws Exception {

        String path = filepath + "sdzzUserRegister.json";

        UserAccess userAccess = new UserAccess("15850534308","444");
        //android+2.4+y155

        UserAppInfo userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y155");
        userAppInfo.setClientId("35f22c23df4718aded4d1b667a89095");
        userAppInfo.setGuestId("9e57b02415444e0d8c0989b34344f67d7");
        userAppInfo.setPlatform(PlatformEnum.IOS);
        userAppInfo.setVersion("2.4");

        userAccess.setUserAppInfo(userAppInfo);

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path);

        //ios+2.4+y14

        userAccess = new UserAccess("15850534309","asd");

        userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y14");
        userAppInfo.setClientId("35f22c23df4718ad55964d1b61bfa890890");
        userAppInfo.setGuestId("9e57b02415444e0d8c58459b34344f67456");
        userAppInfo.setPlatform(PlatformEnum.ANDROID);
        userAppInfo.setVersion("1.2");

        userAccess.setUserAppInfo(userAppInfo);

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path,true);

    }

    @Test
    public void registerQSYQ() throws Exception {

        String path = filepath + "qsyqUserRegister.json";

        UserAccess userAccess = new UserAccess("15850534310","444");
        //android+2.4+y155

        UserAppInfo userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y155");
        userAppInfo.setClientId("35f22c23df4718aded4d1b667a89095");
        userAppInfo.setGuestId("9e57b02415444e0d8c0989b34344f67d7");
        userAppInfo.setPlatform(PlatformEnum.IOS);
        userAppInfo.setVersion("2.4");

        userAccess.setUserAppInfo(userAppInfo);

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path);

        //ios+2.4+y14

        userAccess = new UserAccess("15850534311","dsdflskf");

        userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y14");
        userAppInfo.setClientId("35f22c23df4718ad55964d1b61bfa890890");
        userAppInfo.setGuestId("9e57b02415444e0d8c58459b34344f67456");
        userAppInfo.setPlatform(PlatformEnum.ANDROID);
        userAppInfo.setVersion("1.2");

        userAccess.setUserAppInfo(userAppInfo);

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path,true);


        //ios+2.3+y189

        userAccess = new UserAccess("15850534312","qwer");

        userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y189");
        userAppInfo.setClientId("dslsjdlksdlicvsdbc2392394sjdfiujsd92");
        userAppInfo.setGuestId("22345dfddddddddddfoweifwpoerwierwpoer");
        userAppInfo.setPlatform(PlatformEnum.OTHER);
        userAppInfo.setVersion("2.3");

        userAccess.setUserAppInfo(userAppInfo);

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path,true);

    }



    @Test
    public void login() throws Exception {
        String path = filepath + "login.json";

        UserAccess userAccess = new UserAccess("15850534308","444");
        userAccess.setUserCode("20170728usmb000001300200");

        UserAppInfo userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y155");
        userAppInfo.setClientId("35f22c23df4718aded4d1b667a89095");
        userAppInfo.setGuestId("9e57b02415444e0d8c0989b34344f67d7");
        userAppInfo.setPlatform(PlatformEnum.IOS);
        userAppInfo.setVersion("2.4");

        userAccess.setUserAppInfo(userAppInfo);

        WriteUtils.writeToJsonFile(userAccess,  path);


        userAccess = new UserAccess("15850534310","444");
        userAccess.setUserCode("20170728usmb000001400210");

        userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y189");
        userAppInfo.setClientId("dslsjdlksdlicvsdbc2392394sjdfiujsd92");
        userAppInfo.setGuestId("22345dfddddddddddfoweifwpoerwierwpoer");
        userAppInfo.setPlatform(PlatformEnum.OTHER);
        userAppInfo.setVersion("2.3");

        userAccess.setUserAppInfo(userAppInfo);

        /*userAccess = new UserAccess("15850534309","dsdflskf");
        userAccess.setUserCode("20170728usmb000001000301");

        userAppInfo = new UserBehaviorAppInfo();
        userAppInfo.setChannel("y14");
        userAppInfo.setClientId("35f22c23df4718ad55964d1b61bfa890890");
        userAppInfo.setGuestId("9e57b02415444e0d8c58459b34344f67456");
        userAppInfo.setPlatform(PlatformEnum.ANDROID);
        userAppInfo.setVersion("1.2");

        userAccess.setUserAppInfo(userAppInfo);*/

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path,true);
    }

    @Test
    public void password() throws Exception {
        String path = filepath + "password.json";

        UserAccess userAccess = new UserAccess("15850534308","444");
        userAccess.setUserCode("20170728usmb000001000200");

        UserAppInfo userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y155");
        userAppInfo.setClientId("35f22c23df4718aded4d1b667a89095");
        userAppInfo.setGuestId("9e57b02415444e0d8c0989b34344f67d7");
        userAppInfo.setPlatform(PlatformEnum.IOS);
        userAppInfo.setVersion("2.4");

        userAccess.setUserAppInfo(userAppInfo);

        WriteUtils.writeToJsonFile(userAccess, path);


        userAccess = new UserAccess("15850534310","cychen@1874554");
        userAccess.setUserCode("20170728usmb000001100210");

        userAppInfo = new UserAppInfo();
        userAppInfo.setChannel("y189");
        userAppInfo.setClientId("dslsjdlksdlicvsdbc2392394sjdfiujsd92");
        userAppInfo.setGuestId("22345dfddddddddddfoweifwpoerwierwpoer");
        userAppInfo.setPlatform(PlatformEnum.OTHER);
        userAppInfo.setVersion("2.3");

        userAccess.setUserAppInfo(userAppInfo);

        /*userAccess = new UserAccess("15850534309","asdasd");
        userAccess.setUserCode("20170728usmb000001000301");

        userAppInfo = new UserBehaviorAppInfo();
        userAppInfo.setChannel("y14");
        userAppInfo.setClientId("35f22c23df4718ad55964d1b61bfa890890");
        userAppInfo.setGuestId("9e57b02415444e0d8c58459b34344f67456");
        userAppInfo.setPlatform(PlatformEnum.ANDROID);
        userAppInfo.setVersion("2.4");

        userAccess.setUserAppInfo(userAppInfo);*/

        //最后一个参数设置是否追加写入  默认不追加
        WriteUtils.writeToJsonFile(userAccess, path,true);
    }


}
